< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03020203.xhp

(section: lineinput) (bookmark: bm_id3153361)
Line Input statement

数式入力ボックス文

Line Input # Statement [Runtime]
Line Input # ステートメント [実行時](hd_id3153361.1)

Reads strings from a sequential file into a variable.
順編成ファイルから文字列を読み取り、変数に格納します。(par_id3156280.2)

(/section: lineinput)

Syntax:
構文:(hd_id3150447.3)

Line Input #FileNumber As Integer, Var As String
Line Input #FileNumber As Integer, Var As String(par_id3147229.4)

Parameters:
パラメータ:(hd_id3145173.5)

FileNumber: Number of the file that contains the data that you want to read. The file must have been opened in advance with the Open statement using the key word INPUT.
FileNumber: 読み取るデータを含むファイルの番号。 読み取るファイルは、Open ステートメントに INPUT キーワードを指定して、事前に開いておく必要があります。(par_id3161832.6)

var: The name of the variable that stores the result.
var: 戻り値を格納する変数の名前。(par_id3151119.7)

With the Line Input# statement, you can read strings from an open file into a variable. String variables are read line-by-line up to the first carriage return (Asc=13) or linefeed (Asc=10). Line end marks are not included in the resulting string.
Line Input# ステートメントは、オープン済みのファイルから文字列を読み取って、その値を変数に格納します。文字列は、次に来るキャリッジリターン (ASC=13) かラインフィード (ASC=10) までのデータが、1 行ごとに読み取られます。行末の記号は読み取られません。(par_id3150010.8)

Example:
例:(hd_id3163711.9)

Sub ExampleWorkWithAFile
Sub ExampleWorkWithAFile(par_id3145271.10)

Dim iNumber As Integer
Dim iNumber As Integer(par_id3156444.11)

Dim sLine As String
Dim sLine As String(par_id3147349.12)

Dim aFile As String
Dim aFile As String(par_id3149664.13)

Dim sMsg as String
Dim sMsg as String(par_id3147436.36)

aFile = "c:\data.txt"
aFile = "c:\data.txt"(par_id3154730.14)

iNumber = Freefile
iNumber = Freefile(par_id3145647.16)

Open aFile For Output As #iNumber
Open aFile For Output As #iNumber(par_id3149959.17)

Print #iNumber, "This is a line of text"
Print #iNumber, "This is a line of text"(par_id3147124.18)

Print #iNumber, "This is another line of text"
Print #iNumber, "This is another line of text"(par_id3153415.19)

Close #iNumber
Close #iNumber(par_id3146969.20)

iNumber = Freefile
iNumber = Freefile(par_id3154482.24)

Open aFile For Input As iNumber
Open aFile For Input As iNumber(par_id3150321.25)

While not eof(iNumber)
While not eof(iNumber)(par_id3155443.26)

Line Input #iNumber, sLine
Line Input #iNumber, sLine(par_id3155764.27)

If sLine <>"" then
If sLine <>"" then(par_id3156382.28)

sMsg = sMsg & sLine & chr(13)
sMsg = sMsg & sLine & chr(13)(par_id3147338.29)

end if
end if(par_id3147362.31)

wend
Wend(par_id3155333.32)

Close #iNumber
Close #iNumber(par_id3153965.33)

Msgbox sMsg
Msgbox sMsg(par_id3147345.37)

End Sub
End Sub(par_id3149257.34)


< Prev / Next >